import service from "../serviceIndex";

// 根据用户Id查找用户的所有收货地址
export const selectAllAddressAPI = (userId) => {
  return service({
    method: "get",
    url: `/pipayshopapi/buyer-data/selectAllAddress/${userId}`,
  });
};

// 插入买家的收货地址
export const insectBuyerDataAPI = ({ address, phone, userId, userName }) => {
  return service({
    method: "post",
    url: `/pipayshopapi/buyer-data/insectBuyerData`,
    data: {
      address,
      phone,
      userId,
      userName,
    },
  });
};

// 根据收货Id更改买家的收货地址
export const updateBuyerDataByIdAPI = ({
  address ,
  buyerDataId,
  phone,
  userId,
  userName
}) => {
  return service({
    method: "post",
    url: `/pipayshopapi/buyer-data/updateBuyerDataById`,
    data: {
      address,
      buyerDataId,
      phone,
      userId,
      userName
    },
  });
};

// 根据id删除买家的收货地址等数据
export const deleteBuyerDataByIdAPI = (buyerId) => {
  return service({
    method: "post",
    url: `/pipayshopapi/buyer-data/deleteBuyerDataById/${buyerId}`,
  });
};

//查找品牌信息的集合
export const selectAllBrandListAPI = () => {
  return service({
    method: "get",
    url: `/pipayshopapi/brand-info/selectAllBrandList}`,
  });
};

//网店首级分类标签列表展示
export const topCateListAPI = (categoryPid) => {
  return service({
    method: "get",
    url: `/pipayshopapi/category/selectAllCategory/${categoryPid}`,
  });
};

//网店二级分类标签列表展示
export const secondCateListAPI = (categoryPid) => {
  return service({
    method: "get",
    url: `/pipayshopapi/category/selectAllCategory/${categoryPid}`,
  });
};

export const setSkulist = (categoryPid) => {
  return service({
    method: "get",
    url: `/pipayshopapi/sku/listSku/${categoryPid}`,
  });
};



// 根据收货数据id修改默认地址
export const faultAddressAIP = (buyerDataId) => {
  return service({
    method: "post",
    url: `/pipayshopapi/buyer-data/updateDefaultAddress/${buyerDataId}`,
  });
};


// 获取区域对应酒店数量
export const getHotelCountByRegion = (regionData) => {
  return service({
    method: "post",
    url: `/pipayshopapi/shop-info/countByRegionIds`,
    data: regionData
  });
}
// 获取国家列表数据
export const getCountryList = () => {
  return service({
    method: "get",
    url: `/pipayshopapi/user-info/getCountryList`,
  });
};

// 获取二级行政区域列表
export const getSecondDistrictList = (countryCode) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-info/getSecondDistrictList/${countryCode}`,
  });
};

// 获取三级行政区域列表
export const getThirdDistrictList = (countrySecondId) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-info/getThirdDistrictList/${countrySecondId}`,
  });
};

// 获取四级行政区域列表
export const getFourthDistrictList = (countryThirdId) => {
  return service({
    method: "get",
    url: `/pipayshopapi/store-info/getFourthDistrictList/${countryThirdId}`,
  });
};
